package jmine.tec.hydra;

import java.io.IOException;
import java.io.InputStream;
import java.io.Serializable;
import java.util.Map;

import jmine.tec.hydra.api.HydraMessage;

/**
 * Encapsula os dados para o activation
 * 
 * @author george.queiroz jan/2010
 */
public class ReceiveActivationData implements Serializable {

    private final HydraMessage message;

    /**
     * Construtor.
     * 
     * @param message mensagem
     */
    public ReceiveActivationData(HydraMessage message) {
        this.message = message;
    }

    /**
     * @return the messageProperties
     */
    public Map<String, String> getMessageProperties() {
        return this.message.getProperties();
    }

    /**
     * @return the messageContent
     * @throws IOException IOException
     */
    public String getMessageContent() throws IOException {
        return this.message.getBodyAsString("UTF-8");
    }

    /**
     * @param charsetName charsetName
     * @return the messageContent
     * @throws IOException IOException
     */
    public String getMessageContent(String charsetName) throws IOException {
        return this.message.getBodyAsString(charsetName);
    }

    /**
     * @return the messageContent
     */
    public InputStream getMessageInput() {
        return this.message.getBody();
    }
}
